package com.yf.domain.security;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * @author chentianwei
 * @date 2024-10-29 12:39
 * @description 岗位Domain
 */
@Getter
@Setter
@TableName(value = "sys_job")
public class Job implements Serializable {

    @TableId(value = "job_id", type = IdType.AUTO)
    @Schema(name = "ID", hidden = true)
    private Long id;

    @Schema(name = "岗位名称")
    private String name;

    @Schema(name = "岗位排序")
    private Long jobSort;

    @Schema(name = "是否启用")
    private Boolean enabled;

    @TableField(value = "create_time",insertStrategy = FieldStrategy.DEFAULT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Timestamp createTime;

    @TableField(value = "update_time",updateStrategy = FieldStrategy.ALWAYS)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Timestamp updateTime;

    @TableField(value = "create_by",insertStrategy = FieldStrategy.DEFAULT)
    private String createBy;

    @TableField(value = "update_by",updateStrategy = FieldStrategy.ALWAYS)
    private String updateBy;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Job job = (Job) o;
        return Objects.equals(id, job.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
